<?php if (!defined('BASEPATH')) exit('Access Deny');
class Db_Exception extends Exception
{
    public function __construct($errMsg, $code = 0)
    {
        parent::__construct($errMsg, $code);
    }
    
    public function getError()
    {
        $str = sprintf("\nDatabase Error: on line %d in file %s.", $this->line, $this->file);
        $str .= sprintf("\nReason: %s", $this->message);
        return $str;
    }
    
    public function __toString()
    {
        return __CLASS__ . ":[{$this->code}]: {$this->message}\n";
    }
}